package me.softwareengineer.guice.rendering.domain;

import me.softwareengineer.guice.rendering.listener.Listener;
import me.softwareengineer.guice.rendering.listener.OnEmptyLineEvent;

/**
 * Represents empty line between two elements. For instance, an empty line between
 * two tables.
 * 
 * <p>
 * This class generates the following events:
 * <ul>
 * <li>{@link OnEmptyLineEvent}</li>
 * </ul>
 * </p>
 * 
 * <pre>
 * This class is thread-safe and can be cached/re-used and used concurrently.
 * </pre>
 * 
 * @author yadtahir
 * @since 1.0
 * @see OnEmptyLineEvent
 * @see Element
 */
//This class is marked as final because we want to make it immutable as much as possible
public final class EmptyLineElement extends Element {
	private final int numberOfLine;
	

	/**
	 * Creates an empty line element with numberOfLine equals one.
	 */
	public EmptyLineElement() {
		numberOfLine = 1;
	}

	/**
	 * Creates an empty line with the given number of lines
	 * 
	 * @param numberOfLine
	 *            number of lines
	 */
	public EmptyLineElement(int numberOfLine) {
		this.numberOfLine = numberOfLine;
	}

	/**
	 * 
	 * @return number of line in the element
	 * <pre>
	 * This property is immutable and thread-safe
	 * </pre>
	 */
	public int getNumberOfLine() {
	
			return numberOfLine;
		

	}

	/**
	 * {@inheritDoc}
	 * 
	 * This method triggers {@link OnEmptyLineEvent} event.
	 */
	@Override
	public void render(Listener listener) {
		OnEmptyLineEvent e = new OnEmptyLineEvent(getNumberOfLine());
		listener.onEvent(e);

	}

	
}
